<?php

namespace App\V3\V3_2_7\Controllers;

use App\V3\V3_2_7\Services\CustomerService;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Validator;
use Illuminate\Validation\Rule;

class CustomerServiceController extends BaseController
{

    /**
     *客服与打印机购买链接管理
     * Author: zlf
     * Created at 2024/2/28 10:41
     * @param Request $request
     * @return \Illuminate\Http\JsonResponse
     */
    public function edit(Request $request)
    {
        //参数验证
        $validator = Validator::make($data = $request->all(), [
            'id' => 'integer',//id
        ],
        [
            'id.integer' => '参数`id`只能为整型',

        ]);
        if($this->getUserId() != 1){
            return $this->fail('','您不是管理员，无法操作！');
        }
        //参数错误响应
        if ($info = $validator->errors()->first()) {
            return fail('',$info);
        }
        return CustomerService::edit($data);
    }

}
